import { CurveRange, find, _decorator, Graphics, Color, Component, director, Director, JsonAsset, Node, RealCurve, SpriteComponent, Sprite } from 'cc';
const { ccclass, property, executionOrder } = _decorator;
import { Animal } from '../global/EnumList';
import { Test } from '../tmp/Test';
import { delay } from '../global/Func';


  class TreeNode {
      val: number
      left: TreeNode | null
      right: TreeNode | null
      constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {
          this.val = (val===undefined ? 0 : val)
          this.left = (left===undefined ? null : left)
          this.right = (right===undefined ? null : right)
      }
  }
  class ListNode {
      val: number
      next: ListNode | null
      constructor(val?: number, next?: ListNode | null) {
          this.val = (val===undefined ? 0 : val)
          this.next = (next===undefined ? null : next)
      }
  }

var reformatDate = function(date) {
      const m = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
    let[day,month,year]=date.split(" ");
    month =('0'+(m.indexOf(month)+1)).slice(-2);
    day=('0'+day).slice(-4,-2);
    return `${year}-${month}-${day}`;
};

@ccclass('RootMgr')
@executionOrder(-1)
export class RootMgr extends Component {



  @property(Graphics)
  gp: Graphics = null;

  @property(JsonAsset)
  vConf: JsonAsset = null;

  @property(JsonAsset)
  animal: JsonAsset = null;

  onLoad() {
    // console.log(this.vConf.json.version);
    director.addPersistRootNode(this.node);

    let a =this.getComponent(Sprite);
    /*
    var ani =new Animal();    
    let jsonTxt =this.animal.json;
     Object.assign(ani,jsonTxt);
      ani.printMsg();
      console.log(ani._name+"obj");
      */

    this.testAlgo();

  }

  removeTs() {

  }
  testAlgo() {



  }
}




